package 等待通知_卖包子;

import java.util.concurrent.LinkedBlockingQueue;

public class 生产者 extends Thread{
   private ZhengTi<BaoZi> zt;
    //private LinkedBlockingQueue zt;
    public 生产者(ZhengTi<BaoZi> zt) {
        this.zt = zt;
    }
   /* public 生产者(LinkedBlockingQueue<BaoZi> zt) {
        this.zt = zt;
    }
*/
    @Override
    public void run() {
        int i=0;
        while (i<10){
            i++;
            BaoZi bz=new BaoZi("包子"+i);
            zt.add(bz);
            try {
                //zt.put(bz);
            System.out.println(Thread.currentThread().getName()+"生产了"+bz);

                Thread.sleep(200);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
